package com.crm.system.controller.callCenter;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.system.service.callCenter.CallResultRankSerice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 业绩排名-呼叫中心
 * @Author lixq-f
 * @Date 2021/4/28
 * @Version V1.0
 **/
@RestController
@RequestMapping("/callCenter")
@Slf4j
public class CallResultRankController {


    @Autowired
    private CallResultRankSerice rankSerice;

    /**
     * @Description: 获取通话统计
     * @Param: [dateType, accountId]
     * @Return: com.crm.common.model.DataResponse
     * @Author: lixq-f
     * @Date: 2021/4/28
     **/
    @PostMapping("/callStatistics")
    public DataResponse selectCallStatistics(@RequestParam(value = "dateType") Integer dateType,
                                             @RequestParam(value = "accountId") String accountId) {
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(), rankSerice.selectCallStatistics(dateType, accountId));
    }


    /**
     * @Description: 呼叫次数折线图
     * @Param: [dateType, accountId]
     * @Return: com.crm.common.model.DataResponse
     * @Author: lixq-f
     * @Date: 2021/4/28
     **/
    @PostMapping("/callTimesStatistics")
    public DataResponse selectCallTimesStatistics(@RequestParam(value = "dateType") Integer dateType,
                                                  @RequestParam(value = "accountId") String accountId) {
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(), rankSerice.selectCallTimesStatistics(dateType, accountId));
    }


    /**
     * @Description: 个人业绩-时长表格统计
     * @Param: [dateType, accountId]
     * @Return: com.crm.common.model.DataResponse
     * @Author: lixq-f
     * @Date: 2021/4/28
     **/
    @PostMapping("/callDurationStatistics")
    public DataResponse selectCallDurationStatistics(@RequestParam(value = "dateType") Integer dateType,
                                                     @RequestParam(value = "accountId") String accountId) {
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(), rankSerice.selectCallDurationStatistics(dateType, accountId));
    }


}
